/**
 * 
 */
package main;

import gui.controller.MainController;
import helden.plugin.HeldenAusruestungPlugin2;
import helden.plugin.ausruestungsplugin.PluginHeldenAusruestungWerkzeug2;
import helden.plugin.werteplugin2.PluginHeld2;

import java.net.URL;
import java.net.URLClassLoader;
import java.security.CodeSource;
import java.security.ProtectionDomain;

import javax.swing.ImageIcon;
import javax.swing.JFrame;

import backend.VersionsChecker;

/**
 * @author Christian
 * 
 */
public class Ausruestungsstart implements HeldenAusruestungPlugin2 {
	
	public static String version = "1.0";
	
	public static String xmlVersion = "1.0";
	
	/**
	 * @see helden.plugin.HeldenAusruestungPlugin#doWork(javax.swing.JFrame,
	 *      helden.plugin.werteplugin.PluginHeld[], helden.plugin.PluginHeldenAusruestungWerkzeug)
	 */
	@Override
	public void doWork(JFrame frame, PluginHeld2[] helden, PluginHeldenAusruestungWerkzeug2 phaw) {

		
		new MainController(frame, helden, phaw);
		VersionsChecker.checkForUpdate(false);
	}
	
	/**
	 * @see helden.plugin.HeldenPlugin#doWork(javax.swing.JFrame)
	 */
	@Override
	public void doWork(JFrame frame) {

		System.out.println("Darf nicht vorkommen!!");
	}
	
	/**
	 * @see helden.plugin.HeldenPlugin#getIcon()
	 */
	@Override
	public ImageIcon getIcon() {

		ProtectionDomain currentProtectionDomain = getClass()
		.getProtectionDomain();
		CodeSource codeSource = currentProtectionDomain.getCodeSource();
		URL iconUrl = new URLClassLoader(new URL[] { codeSource.getLocation() })
				.getResource("gui/icons/schwerter.gif");
		ImageIcon icon = new ImageIcon(iconUrl);
		return icon;
	}
	
	/**
	 * @see helden.plugin.HeldenPlugin#getMenuName()
	 */
	@Override
	public String getMenuName() {

		return "AusrüstungsPlugin";
	}
	
	/**
	 * @see helden.plugin.HeldenPlugin#getToolTipText()
	 */
	@Override
	public String getToolTipText() {

		return "Setzen von viel Ausrüstung";
	}
	
	/**
	 * @see helden.plugin.HeldenPlugin#getType()
	 */
	@Override
	public String getType() {

		return AUSRUESTUNG;
	}
	
	public static String getVersion() {

		return version;
	}

	/**
	 * @return
	 */
	public static String getXMLVersion() {

		return xmlVersion;
	}
}
